#ifndef UDPSR_H
#define UDPSR_H

#define MAX_LINE_LENGTH 1024
#define MAX_PARAM_LENGTH 20
#define RBCP_VER 0xFF
#define RBCP_CMD_WR 0x80
#define RBCP_CMD_RD 0xC0

#define UDP_BUF_SIZE 2048

#define RBCP_DISP_MODE_NO 0
#define RBCP_DISP_MODE_INTERACTIVE 1
#define RBCP_DISP_MODE_DEBUG 2

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include <sys/types.h>
#include <ctype.h>

typedef struct tcp_udp{
    char tcp_addr[18];
    int tcp_port;
    char udp_addr[18];
    int udp_port;
}net_info;

typedef struct RbcpHeader{
    unsigned char type;
    unsigned char command;
    unsigned char id;
    unsigned char length;
    unsigned int address;
}RbcpHeader;

class UdpSR 
{
    
public:
     UdpSR();
    int rbcp(char *cmdStr, char *sndHeaderAddr, char *pSendData);
private:
    unsigned int myAtoi(char* str);

    int rbcp_com(char *udpAddr, unsigned int udpPort, RbcpHeader *sendHeader, char *sendData, char *recvData, char dispMode);

    int dispatchCommand(char *cmdStr, char *sndHeaderAddr, char *pSendData, char *udpAddr, unsigned int udpPort, RbcpHeader *sndHeader, char dispMode);

};

#endif // UDPSR_H


